<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  
  <div id="app">
    <home></home>
  </div>
  <script src="./vue.js"></script>
  <script>
    const Home = {
      template: `
        <div>
          <button @click="msg = 22222">按钮</button>
          <h2 ref="title">{{msg}}</h2>
        </div>
      `,
      data () {
        return {
          msg: '111'
        }
      },
      beforeCreate() {
        console.log("实例初始化完成之前")
      },
      created () {
        console.log("实例初始化完成-- created");
        console.log(this.$refs.title);
      },
      beforeMount(){
        console.log('dom编译之前')
      },
      mounted(){
        console.log('dom编译完成')
        console.log(this.$refs.title);
      },
      beforeUpdate() {
        console.log('数据改变dom更新之前')
      },
      updated() {
        console.log('数据改变，dom更新完毕')
      },
      beforeDestroy() {
        console.log('实例销毁之前')
      },
      destroyed() {
        console.log('实例已经销毁')
      }
    }
    Vue.component('Home', Home)
    const vm = new Vue({
      el: '#app'
    })
  </script>
</body>
</html>